{extends file="../home.html"}
{block name="title"}{$head_title}{/block}
{block name="css"}
<!-- <link rel="stylesheet" style="text/css" href="__PUBLIC__/Css/front/user_glb.css?version={$version}"> -->

<style type="text/css">

</style>
{/block}
{block name="content"}
<form>
    <div class="service_header">
        <i class="icon icon_back_default3x" style="top:.7rem"></i>
        <span>返回</span>
        <p>{$title}</p>
        <!-- <a href="javascript:;" class="icon icon_search3x"></a> -->
    </div>
    <ul class="visit_from">
        <li class="clearfix">
            <label for="yin" class="fl">拟入驻园区</label>
            <input type="text" id="yin" name="incubator_name"  value="{$incubator_info.incubator_name}" readonly>
        </li>
        <li class="clearfix">
            <label for="date" class="fl">预约时间</label>
            <input type="date" id="date" name="order_time" value="" placeholder="请选择预约时间">
            <i class="fr icon icon_enter_default3x"></i>
        </li>
        <li class="clearfix">
            <label for="name" class="fl">公司/项目名称</label>
            <input type="text" id="name" name="company_name" value="" placeholder="请输入公司/项目名称">
        </li>
        <li class="clearfix">
            <label for="name_ren" class="fl">联系人姓名</label>
            <input type="text" id="name_ren" name="contacts" value="" placeholder="请输入预约人姓名">
        </li>
        <li class="clearfix">
            <label for="tell" class="fl">联系人电话</label>
            <input type="number" id="tell" name="contact_number" value="" placeholder="请输入联系人电话">
        </li>
        <li class="clearfix">
            <label for="number" class="fl">工位数量</label>
            <!--  <select name="" id="number">
                  <option value="请选择参观人数">请选择参观人数</option>
              </select>-->
            <input type="number" id="number" name="visit_num" value="" placeholder="请输入工位数量">
            <input type="hidden" value="order" name="opt">
            <input type="hidden" value="{$incubator_id}" name="incubator_id">
            <input type="hidden" value="{$type}" name="type">
        </li>
        <li class="clearfix">
            <label for="station_type" class="fl">工位类型</label>
            <select name="station_type" id="station_type">
                <option value="0">请选择工位类型</option>
                {foreach from=$incubator_list item=incubator}
                <option value="{$incubator.station_type_id}">{$incubator.station_type_name}</option>
                {/foreach}
            </select>
            <i class="fr icon icon_enter_default3x"></i>
        </li>
    </ul>
    <h6 class="bei">备注</h6>
    <textarea name="user_remarks" placeholder="请输入备注" class="bei_txt"></textarea>
    <h6 class="bei">上传商业计划书</h6>
    <div class="up_img clearfix">
        <div class="up_img_box fl">
            <a href="javascript:;" class="add icon fl icon_upload_default3x" title="上传一张新的图片" id="add_upload"></a>
            <input type="hidden" name="prospectus_url" class="img_url" id="img_url" />
        </div>
        <div class="preview fl clearfix img_html"></div>
    </div>
</form>
<a href="javascript:;" class="submit_btn">提交</a>
{/block}
{block name="js"}
<script>
    incubator_id={$incubator_id}
</script>
{literal}
<script type="text/javascript" src="/Public/Js/front/front_js/ajaxupload.3.5.js"></script>
<script type="text/javascript">
    /*  $(window).load(function() {
     });*/
    new AjaxUpload("#add_upload", {
        action: "/Front/uploadHandler",
        name: "upfile",
        responseType: "json",
        onSubmit: function(){
            //alert('正在上传');
            //preview处的图片改为loading图片
            $('.preview').show();
            if($("#add_upload").siblings('.preview').find('img').length>=10){
                alert("最多上传10张图片");
                return false;
            }
        },
        onChange: function(file, extension){
            if (extension && /^(jpg|png|jpeg|gif)$/.test(extension)) {
                return true;
            }
            else {
                alert('暂不支持该图片格式！');
                return false;
            }
        },
        onComplete: function(file, response){
            //  console.log(response);
            if (response.status === 0) {
                alert(response.msg);
            }
            else if (response.status === 1) {
                var html;
                html='<div class=" fl img_box"><img class="pic-preview" src="'+response.img_url+'"/><div class="del_img"></div></div>';
                $('.preview').append(html);
                // $("#add_upload").siblings('.preview').show();
                $("#img_url").val(1);
            }
        }
    });
    $(function()
    {
        $(".service_header i,.service_header span").on("click",function()
        {
            history.go(-1);
        });
        $(".submit_btn").on("click",function()
        {
            if($("#yin").val()=='')
            {
                layer.open({
                    content: '请输入预约园区',
                    title: false,
                    btn: ['确定'],
                });
                return;
            }
            if($("#name").val()=='')
            {
                layer.open({
                    content: '请输入公司/项目名称',
                    title: false,
                    btn: ['确定'],
                });
                return;
            }
            if($("#name_ren").val()=='')
            {
                layer.open({
                    content: '请输入预约人姓名',
                    title: false,
                    btn: ['确定'],
                });
                return;
            }
            if($("#tell").val()=='')
            {
                layer.open({
                    content: '请输入联系人电话',
                    title: false,
                    btn: ['确定'],
                });
                return;
            }
            $.ajax({
                type: 'POST',
                url: '/FrontIncubator/order_park_enter' ,
                data: $('form').serialize(),
                dataType:'json',
                success:function(data) {
                    console.log(data)
                    if(data.code == 1 ){
                        alert(data.msg);
                        location.href ="/FrontIncubator/park_detail/incubator_id/"+incubator_id;
//
                    }else{
//                               // layer.msg(data.msg,{icon:5});
                        alert(data.msg);
                    }
                }
            })

        });
    });

</script>
{/literal}
{/block}